class LineElement:
    Counter = 0
    nlist = []
    instances = []
    def __init__(self):
        LineElement.Counter += 1


    class ElasticBeamColumn:
        # element elasticBeamColumn $eleTag $iNode $jNode $A $E $G $J $Iy $Iz $transfTag <-mass $massDens> <-cMass>
        Counter = 0
        def __init__(self, n, iNode, jNode, A, E, G, J, Iy, Iz, transfTag, massDens=0, cMass=False):
            self.n = n
            self.iNode = iNode
            self.jNode = jNode
            self.A = A
            self.E = E
            self.G = G
            self.J = J
            self.Iy = Iy
            self.Iz = Iz
            self.transfTag = transfTag
            self.massDens = massDens
            self.cMass = cMass
            LineElement.ElasticBeamColumn.Counter += 1
            self.name = 'ElasticBeamColumn%d' % LineElement.ElasticBeamColumn.Counter
            GTList = filter(lambda x: x.n == self.transfTag, GeometricTransformation.instances)
            if len(GTList) == 0:
                Error("No Geometric Transformation Tagged %d" % self.transfTag)
            else:
                self.GTName = GTList[0].name
            if self.massDens == 0 and self.cMass == False:
                self.command = 'ElasticBeam3d *%s = new ElasticBeam3d(%d, %f, %f, %f, %f, %f, %f, %d, %d, *%s);\n' % (self.name, self.n, self.A, self.E, self.G, self.J, self.Iy, self.Iz, self.iNode, self.jNode, self.GTName)
            else:
                self.command = 'ElasticBeam3d *%s = new ElasticBeam3d(%d, %f, %f, %f, %f, %f, %f, %d, %d, *%s, %f);\n' % (self.name, self.n, self.A, self.E, self.G, self.J, self.Iy, self.Iz, self.iNode, self.jNode,self.GTName, self.massDens)
            LineElement.instances.append(self)
            if self.n in LineElement.nlist:
                Error("There's already an Element No.%d" % self.n)
            else:
                uniaxialMaterial.nlist.append(n)

        def n(self):
            return self.n

        def E(self):
            return self.E

        def A(self):
            return self.A

        def G(self):
            return self.G

        def J(self):
            return self.J

        def Iy(self):
            return self.Iy

        def Iz(self):
            return self.Iz

        def iNode(self):
            return self.iNode

        def jNode(self):
            return self.jNode

        def transfTag(self):
            return self.transfTag

        def GTName(self):
            return self.GTName

        def massDens(self):
            return self.massDens

        def cMass(self):
            return self.cMass

        def include(self):
            return ["ElasticBeam3d.h"]

        def name(self):
            return self.name

        def command(self):
            return self.command

    class ElasticTimoshenkoBeamColumn:
        # element ElasticTimoshenkoBeam $eleTag $iNode $jNode $E $G $A $Jx $Iy $Iz $Avy $Avz $transfTag <-mass $massDens> <-cMass>
        Counter = 0
        def __init__(self, n, iNode, jNode, E, G, A, J, Iy, Iz, Avy, Avz, transfTag, massDens=0, cMass=False):
            self.n = n
            self.iNode = iNode
            self.jNode = jNode
            self.A = A
            self.E = E
            self.G = G
            self.J = J
            self.Iy = Iy
            self.Iz = Iz
            self.Avy = Avy
            self.Avz = Avz
            self.transfTag = transfTag
            self.massDens = massDens
            self.cMass = cMass
            LineElement.ElasticTimoshenkoBeam.Counter += 1
            self.name = 'ElasticTimoshenkoBeam%d' % LineElement.ElasticTimoshenkoBeam.Counter
            GTList = filter(lambda x: x.n == self.transfTag, GeometricTransformation.instances)
            if len(GTList) == 0:
                Error("No Geometric Transformation Tagged %d" % self.transfTag)
            else:
                self.GTName = GTList[0].name
            if self.massDens == 0 and self.cMass == False:
                self.command = 'ElasticTimoshenkoBeam3d *%s = new ElasticTimoshenkoBeam3d(%d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, *%s);\n' % (self.name, self.n, self.iNode, self.jNode, self.E, self.G, self.A, self.J, self.Iy, self.Iz, self.Avy, self.Avz, self.GTName)
            else:
                self.command = 'ElasticTimoshenkoBeam3d *%s = new ElasticTimoshenkoBeam3d(%d, %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, *%s, %f);\n' % (self.name, self.n, self.iNode, self.jNode, self.E, self.G, self.A, self.J, self.Iy, self.Iz, self.Avy, self.Avz, self.GTName, self.massDens)
            LineElement.instances.append(self)
            if self.n in LineElement.nlist:
                Error("There's already an Element No.%d" % self.n)
            else:
                uniaxialMaterial.nlist.append(n)

        def n(self):
            return self.n

        def E(self):
            return self.E

        def A(self):
            return self.A

        def G(self):
            return self.G

        def J(self):
            return self.J

        def Iy(self):
            return self.Iy

        def Iz(self):
            return self.Iz

        def Avy(self):
            return self.Avy

        def Avz(self):
            return self.Avz

        def iNode(self):
            return self.iNode

        def jNode(self):
            return self.jNode

        def transfTag(self):
            return self.transfTag

        def GTName(self):
            return self.GTName

        def massDens(self):
            return self.massDens

        def cMass(self):
            return self.cMass

        def include(self):
            return ["ElasticTimoshenkoBeam3d.h"]

        def name(self):
            return self.name

        def command(self):
            return self.command
